<template>
	<view class="container">
		<view class="layout">
			<view class="head">
				<view class="left">
					<view class="pic">
						<image src="@/static/images/defaultHead.png" class="pic"></image>
					</view>
					<view class="info">
						<view class="name">{{ state.data?.agent?.nickname }}</view>
						<view class="time">{{ state.data?.time_jihuo }}</view>
					</view>
				</view>
				<view class="right">
					<text class="num">+{{ state.data?.agent?.reward }}</text>
					<text class="tag">已激活</text>
				</view>
			</view>
			<view class="body">
				<view class="h3">会员信息：</view>
				<view class="msg">
					<view class="label">姓名</view>
					<view class="text">{{ state.data?.nickname }}</view>
				</view>
				<view class="msg">
					<view class="label">手机</view>
					<view class="text">{{ state.data?.tel }}</view>
				</view>
				<view class="msg">
					<view class="label">地址</view>
					<view class="text">{{ state.data?.address }}</view>
				</view>
				<view class="msg">
					<view class="label">激活时间</view>
					<view class="text">{{ state.data?.time_jihuo }}</view>
				</view>
				<view class="msg">
					<view class="label">手机串码</view>
					<view class="text">{{ state.data?.imei }}</view>
				</view>
				<view class="msg">
					<view class="label">代理商编码</view>
					<view class="text">{{ state.data?.agent_number }}</view>
				</view>
				<view class="msg">
					<view class="label">兑换码</view>
					<view class="text">{{ state.data?.change_code }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import { reactive } from 'vue';
import { get } from '@/request/index.js';
import { onLoad } from '@dcloudio/uni-app';

onLoad(async (option) => {
	await getDetail(option.id);
});
const state = reactive({
	data: {}
});
const getDetail = async (id) => {
	const res = await get('agent/change/info', { id });
	const { code, data } = res;
	if (code == 200) {
		state.data = data;
	}
};
</script>
